<div class="container">
  <h1>count_rows()</h1>
  <p class="signature">public function count_rows(string $column, $value, ?string $target_table = null): int</p>
  
  <h2>Description</h2>
  <div class="description">
    <p>
      Counts the number of rows in a database table based on a single condition. This method constructs and executes an SQL query to count the rows in the specified table that match the provided condition.
    </p>
  </div>
  
  <h2>Parameters</h2>
  <table>
    <thead>
      <tr>
        <th>Parameter</th>
        <th>Type</th>
        <th>Description</th>
        <th>Default</th>
        <th>Required</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>column</td>
        <td>string</td>
        <td>The name of the table column referred to when fetching results.</td>
        <td>N/A</td>
        <td>Yes</td>
      </tr>
      <tr>
        <td>value</td>
        <td>mixed</td>
        <td>The value that should be matched against the target table column.</td>
        <td>N/A</td>
        <td>Yes</td>
      </tr>
      <tr>
        <td>target_table</td>
        <td>string|null</td>
        <td>(optional) The name of the database table to be queried. If not explicitly passed, the table name is assumed to be the value of the first URL segment.</td>
        <td>'First URL segment'</td>
        <td>No</td>
      </tr>
    </tbody>
  </table>
  
  <h2>Return Value</h2>
  <table>
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>int</td>
        <td>The number of rows matching the condition.</td>
      </tr>
    </tbody>
  </table>
  
  <h2>Exceptions</h2>
  <table>
    <thead>
      <tr>
        <th>Exception Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>RuntimeException</td>
        <td>Thrown if the query execution fails.</td>
      </tr>
    </tbody>
  </table>
  
  <h2>Example Usage</h2>
  <div class="example">
    <pre>$column = 'status';
$value = 'active';
$target_table = 'users';
$num_active_users = $this->model->count_rows($column, $value, $target_table);</pre>
  </div>
  
</div>
